﻿
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
    <style type="text/css">
    <!--
    
    #edit
    {
        opacity: 0.8;
    }   
    #edit:hover
    {
        opacity: 1;
    }
    #del
    {
        opacity: 0.8;
    }
    #del:hover
    {
        opacity: 1;
    }   
    #check
    {
        opacity: 0.8;
    }
    #check:hover
    {
        opacity: 1;
    }
        
    -->
    </style>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    	<script src="ckeditor/_samples/sample.js" type="text/javascript"></script>
    	<link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    
    
          <?php
                    include("code/DataProvider.php");
                    $key = $_REQUEST["txtSearchHD"];
                    $type = $_REQUEST["search"];
                
                if($type == 1)
                {
                    $queryMaDH=" SELECT ddh.MaDDH, ct.MaSP, ct.GiaCa, ct.SoLuong, ddh.NgayDat, nd.TenDangNhap, ddh.TongTien, sp.TenSP
                            FROM DonDatHang ddh, chitietddh ct, nguoidung nd, sanpham sp
                            WHERE ddh.MaDDH = ct.MaDDH AND ddh.MaND = nd.MaND AND ct.MaSP = sp.MaSP AND ddh.MaDDH like '%".$key."%' ";
                    $result = DataProvider::executeQuery($queryMaDH);
                }
                if($type == 2)
                {
                    $queryMaSP=" SELECT ddh.MaDDH, ct.MaSP, ct.GiaCa, ct.SoLuong, ddh.NgayDat, nd.TenDangNhap, ddh.TongTien, sp.TenSP
                            FROM DonDatHang ddh, chitietddh ct, nguoidung nd, sanpham sp
                            WHERE ddh.MaDDH = ct.MaDDH AND ddh.MaND = nd.MaND AND ct.MaSP = sp.MaSP AND ct.MaSP like '%".$key."%' ";
                    $result = DataProvider::executeQuery($queryMaSP);
                }
                if($type == 3)
                {
                    $queryTenSP=" SELECT ddh.MaDDH, ct.MaSP, ct.GiaCa, ct.SoLuong, ddh.NgayDat, nd.TenDangNhap, ddh.TongTien, sp.TenSP
                            FROM DonDatHang ddh, chitietddh ct, nguoidung nd, sanpham sp
                            WHERE ddh.MaDDH = ct.MaDDH AND ddh.MaND = nd.MaND AND ct.MaSP = sp.MaSP AND sp.TenSP like '%".$key."%' ";
                    $result = DataProvider::executeQuery($queryTenSP);
                }
                if($type == 4)
                {
                    $queryTenND=" SELECT ddh.MaDDH, ct.MaSP, ct.GiaCa, ct.SoLuong, ddh.NgayDat, nd.TenDangNhap, ddh.TongTien, sp.TenSP
                            FROM DonDatHang ddh, chitietddh ct, nguoidung nd, sanpham sp
                            WHERE ddh.MaDDH = ct.MaDDH AND ddh.MaND = nd.MaND AND ct.MaSP = sp.MaSP AND nd.TenDangNhap like '%".$key."%' ";
                    $result = DataProvider::executeQuery($queryTenND);
                }
                if($type == 5)
                {
                    $queryTT=" SELECT ddh.MaDDH, ct.MaSP, ct.GiaCa, ct.SoLuong, ddh.NgayDat, nd.TenDangNhap, ddh.TongTien, sp.TenSP
                            FROM DonDatHang ddh, chitietddh ct, nguoidung nd, sanpham sp
                            WHERE ddh.MaDDH = ct.MaDDH AND ddh.MaND = nd.MaND AND ct.MaSP = sp.MaSP AND ddh.TongTien like '%".$key."%' ";
                    $result = DataProvider::executeQuery($queryTT);
                }
          
            ?>
              
                <h2 style="color: blue; text-align: center;">DANH SÁCH ĐƠN ĐẶT HÀNG</h2>
                <div><a href="admin.php?act=14">Quay lại</a></div>
                <hr /><br /> 
        <table border="1" cellspacing="0" style=" text-align: center; font-size: 10px;">
        	<tr style="height: 50px; color: white; background: #555;">
                <td align="center" height="30px" width="100px">Mã đơn đặt hàng</td>
                <td align="center" height="30px" width="100px">Mã sản phẩm</td>
                <td align="center" height="30px" width="100px">Tên sản phẩm</td>
                <td align="center" height="30px" width="100px">Giá sản phẩm</td>
                <td align="center" height="30px" width="100px">Số lượng</td>
                <td align="center" height="30px" width="100px">Ngày đặt</td>
                <td align="center" height="30px" width="100px">Người dùng</td>
                <td align="center" height="30px" width="100px">Tổng tiền</td>
                <td align="center" height="30px" width="120px">Xóa ( theo Mã ĐĐH )</td>
            </tr><?php
            while ($row=mysql_fetch_array($result))
    			{?>
            <tr>
                <td align="center" ><?php echo $row['MaDDH']; ?></td>
                <td align="center" ><?php echo $row['MaSP']; ?></td>
                <td align="center" ><?php echo $row['TenSP']; ?></td>
                <td align="center" ><?php echo $row['GiaCa']; ?></td>
                <td align="center" ><?php echo $row['SoLuong']; ?></td>
                <td align="center" ><?php echo $row['NgayDat']; ?></td>
                <td align="center" ><?php echo $row['TenDangNhap']; ?></td>
                <td align="center" ><?php echo $row['TongTien']; ?></td>
                <td align="center" >
                    <a href="admin.php?act=15&id=<?php echo $row['MaDDH']; ?>">
                        <img id="edit" src="images/delete-icon.png" height="25" width="25"/>   
                    </a>
                </td>
            </tr><?php } ?>
    	</table>

    
    
    
    </body>
</html>

